package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.DmService;
import com.example.demo.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DmController {

    @Autowired
    private DmService dmService;

    @GetMapping("/selectUser")
    public List<User> selectUser(){
        return dmService.selectUser();
    }

    @GetMapping("/insertUser")
    public String insertUser(){
        dmService.insert();
        return "insert OK!";
    }

    /**
     *联表查询
     */
    @GetMapping("/syndicationQuery")
    public List<UserVo> selectUserScores(){
        return dmService.selectUserScore();
    }
}
